package sctu.edu.java.year2016.team06.project;



import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

/**
 * Created by LCJ on 2016/6/22.
 */
public class Format {
    public void Document3() throws IOException {   //被User调用，模拟功能：创建workerwrite.txt文本
        File file = new File("D:/workerwrite.txt");
        if(file.exists()) {
            file.delete();
        }
        file.createNewFile();
        DefineFileOutputStream fileOutputStream = new DefineFileOutputStream(file);
        fileOutputStream.write("员工回复：");
        fileOutputStream.close();
    }

    public void Document4() throws IOException {//被User调用，模拟功能：创建userwrite.txt文本
        File file = new File("D:/userwrite.txt");
        if(file.exists()) {
            file.delete();
        }
        file.createNewFile();
        DefineFileOutputStream fileOutputStream = new DefineFileOutputStream(file);
        fileOutputStream.write("用户问题：");
        fileOutputStream.close();
    }

    public void Document5() throws IOException {//被User调用，模拟功能：创建database.txtt文本
        File file = new File("D:/database.txt");
        if(file.exists()) {
            file.delete();
        }
        file.createNewFile();
        FileWriter fw=new FileWriter(file,true);
        BufferedWriter bufw=new BufferedWriter(fw);

        bufw.write("数据库：");

        bufw.flush();
        bufw.newLine();
        bufw.close();
        fw.close();


    }

    public void Document6() throws IOException {//被User调用，模拟功能：创建communication.txt文本
        File file = new File("D:/communication.txt");
        if(file.exists()) {
            file.delete();
        }
        file.createNewFile();
        DefineFileOutputStream fileOutputStream = new DefineFileOutputStream(file);
        fileOutputStream.write("001号员工的回复：");

        fileOutputStream.close();

    }
    public void Document7() throws IOException {//被User调用，模拟功能：创建admin.txt文本
        File file = new File("D:/admin.txt");
        if(file.exists()) {
            file.delete();
        }
        file.createNewFile();
        DefineFileOutputStream fileOutputStream = new DefineFileOutputStream(file);
        fileOutputStream.write("用户反馈：");
        fileOutputStream.close();
    }
    public void Docum() throws IOException {//被User调用，模拟功能：创建enroll.txt文本
        File file = new File("D:/enroll.txt");
        if(!file.exists()) {
            file.createNewFile();
        }

        DefineFileOutputStream fileOutputStream = new DefineFileOutputStream(file);
        fileOutputStream.write("账号：");

        fileOutputStream.close();

    }
    public void Docum1() throws IOException {//被User调用，模拟功能：创建enroll1.txt文本
        File file = new File("D:/enroll1.txt");
        if(!file.exists()) {
            file.createNewFile();
        }

        DefineFileOutputStream fileOutputStream = new DefineFileOutputStream(file);
        fileOutputStream.write("密码：");

        fileOutputStream.close();

    }

    public void Docum3() throws IOException {//被User调用，模拟功能：创建question.txt文本
        File file = new File("D:/question.txt");
        if(file.exists()) {
            file.delete();
        }
        file.createNewFile();
        FileWriter fw=new FileWriter(file,true);
        BufferedWriter bufw=new BufferedWriter(fw);

        bufw.write("问题库：");

        bufw.flush();
        bufw.newLine();
        bufw.close();
        fw.close();


    }

    public void Docum4() throws IOException {//被User调用，模拟功能：创建question.txt文本
        File file = new File("D:/meassage.txt");
        if(file.exists()) {
            file.delete();
        }
        file.createNewFile();
        FileWriter fw=new FileWriter(file,true);
        BufferedWriter bufw=new BufferedWriter(fw);

        bufw.write("留言板 ：");

        bufw.flush();
        bufw.newLine();
        bufw.close();
        fw.close();


    }




    public void delete1(){//被User调用，模拟功能：删除workerwrite.txt文本
        File file = new File("D:/workerwrite.txt");
        if(file.exists()) {
            file.delete();
        }
    }
    public void delete2(){//被User调用，模拟功能：删除userwrite.txt文本
        File file = new File("D:/userwrite.txt");
        if(file.exists()) {
            file.delete();
        }
    }
    public void delete3(){//被User调用，模拟功能：删除database.txt文本
        File file = new File("D:/database.txt");
        if(file.exists()) {
            file.delete();
        }
    }
    public void delete4(){//被User调用，模拟功能：删除communication.txt文本
        File file = new File("D:/communication.txt");
        if(file.exists()) {
            file.delete();
        }
    }
    public void delete5() {//被User调用，模拟功能：删除admin.txt文本
        File file = new File("D:/admin.txt");
        if (file.exists()) {
            file.delete();
        }
    }
    public void delete6() {//被User调用，模拟功能：删除question.txt文本
        File file = new File("D:/question.txt");
        if (file.exists()) {
            file.delete();
        }
    }

    public void delete7() {//被User调用，模拟功能：删除question.txt文本
        File file = new File("D:/meassage.txt");
        if (file.exists()) {
            file.delete();
        }
    }

}
